// 与后端相同的类型定义
export interface WeightRecord {
  id?: number;
  weight: number;
  record_time: string;
  record_type: 'morning' | 'evening' | 'anytime';
  note?: string;
  created_at?: string;
  updated_at?: string;
}

export interface KLineData {
  date: string;
  open: number;
  high: number;
  low: number;
  close: number;
  volume: number;
}

export interface IndicatorData {
  date: string;
  weight_change_rate: number;
  exercise_time_rate: number;
  target_completion_rate: number;
  weight_volatility: number;
  bmi: number;
  consecutive_days: number;
  highest_weight?: number; // 历史最高体重
  lowest_weight?: number; // 历史最低体重
}

export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
}

export interface KLineQuery {
  period: 'day' | 'week' | 'month' | 'year';
  limit?: number;
}

// 分时图数据类型
export interface TimeshareRecord {
  time: string;
  weight: number;
  invertedWeight: number;
  record_type: 'morning' | 'evening' | 'anytime';
  note?: string;
}

export interface TimeshareData {
  date: string;
  records: TimeshareRecord[];
}

// 前端特有的类型
export interface StockUIData {
  current_weight: number;
  weight_change: number;
  weight_change_rate: number;
  highest: number;
  lowest: number;
  volume: number; // 记录次数
}
